<h3>Sửa thông tin thành viên</h3>
<style type="text/css">
td{
	padding:3px 5px
}
tr.title td{
	height:22px;
	font-weight:bold;
	text-align:center;
	background:#FFF
}
fieldset{
	width:400px;
	padding:30px;
	border:1px solid #CCC
}
legend{
	color:#09F
}
</style>
<div style="height:30px"></div>
<?php
require("libraries/users.php");
$users = new users();
$id = $_GET['uid'];
$info = $users->getdata($id);
/*echo "<pre>";
print_r($info);
echo "</pre>";*/
if(isset($_POST['submit'])){
	$name = $_POST['user'];
	$pass = md5($_POST['pass']);
	$full = $_POST['fullname'];
	$gend = $_POST['gender'];
	$level = $_POST['level'];
	$email = $_POST['email'];
	$phone = $_POST['phone'];
	$checkname = $users->checkuser("user_name",$name,$id);
	$checkemai = $users->checkuser("user_email",$email,$id);
	if($checkname == FALSE || $checkemai == FALSE){
		echo "Người dùng này đã tồn tại!";
	}else{
		$users->edit($name,$pass,$full,$gend,$email,$phone,$level,$id);
		header("location:index.php?page=user&act=list");
		exit();
	}
}
?>
<form action="" method="post">
<fieldset>
	<legend>Sửa thành viên</legend>
<table width="350" border="0">
  <tr>
    <td width="143">Tên đăng nhập</td>
    <td width="197"><input type="text" name="user" value="<?php echo $info['user_name']; ?>" size="25"></td>
  </tr>
  <tr>
    <td>Mật khẩu</td>
    <td><input type="password" name="pass" size="25"></td>
  </tr>
  <tr>
    <td>Họ tên</td>
    <td><input type="text" name="fullname" value="<?php echo $info['user_fullname']; ?>" size="25"></td>
  </tr>
  <tr>
    <td>Giới tính</td>
    <td>
    	<select name="gender">
        	<option value="1" <?php if($info['user_gender'] == 1){ echo "selected='selected'";} ?>>Nam</option>
            <option value="0" <?php if($info['user_gender'] == 0){ echo "selected='selected'";} ?>>Nữ</option>
        </select>
    </td>
  </tr>
  <tr>
    <td>Level</td>
    <td>
    	<select name="level">
        	<option value="1" <?php if($info['user_level'] == 1){ echo "selected='selected'";} ?>>admin</option>
            <option value="2" <?php if($info['user_level'] == 2){ echo "selected='selected'";} ?>>Member</option>
        </select>
    </td>
  </tr>
  <tr>
    <td>Số phone</td>
    <td><input type="text" name="phone" value="<?php echo $info['user_phone']; ?>" size="25"/></td>
  </tr>
  <tr>
    <td>Email</td>
    <td><input type="text" name="email" value="<?php echo $info['user_email']; ?>" size="25"/></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value="Sửa thông tin"/></td>
  </tr>
</table>
</fieldset>
</form>